package ckw.utils;

import java.util.Comparator;

import ckw.database.model.ElectionNode;
import ckw.database.model.Member;

public class CustomComparator<T> implements Comparator<T> {

	@Override
	public int compare(T o1, T o2) {
		if (o1 instanceof ElectionNode) {
			return ((ElectionNode) o1).getNode().getName().compareTo(((ElectionNode) o2).getNode().getName());
		} else if (o1 instanceof Member) {
			return ((Member) o1).getSurname().compareTo(((Member) o2).getSurname());
		}
		return 0;
	}

}
